function [out] = predict(test, P, Q, W, X, Y, Z)
             
out = sum(P(:,test(:,3)).*Q(:,test(:,2)),1)' + ...
       sum(W(:,test(:,2)).*X(:,test(:,1)),1)' + ...
       sum(Y(:,test(:,1)).*Z(:,test(:,3)),1)';                
